import Cookies from 'js-cookie'

const TokenKey = 'ucen_template_token'
const userInfoKey = "userInfo"
const userNameKey = "userName"
/**
 * @description 获取单点登录token
 */
export function getToken() {
  // return Cookies.get(TokenKey)

  return sessionStorage.getItem(TokenKey)
}

/**
 * @description 设置单点登录token
 * @param {*} token
 */
export function setToken(token) {
  // return Cookies.set(TokenKey, token)
  return sessionStorage.setItem(TokenKey, token)
}

/**
 * 移除单点登录token
 */
export function removeToken() {
  return sessionStorage.removeItem(TokenKey)
  // return Cookies.remove(TokenKey)
}


//保存用户信息


export function getUserInfo() {
  return sessionStorage.getItem(userInfoKey)
  // return Cookies.get(userInfoKey)
}


export function setUserInfo(userinfo) {
  return sessionStorage.setItem(userInfoKey, userinfo)
  // return Cookies.set(userInfoKey, userinfo)
}

/**
 * 移除
 */
export function removeUserInfo() {
  return sessionStorage.removeItem(userInfoKey)
  // return Cookies.remove(userInfoKey)
}





export function getUserName() {
  return sessionStorage.getItem(userNameKey)
  // return Cookies.get(userNameKey)
}


export function setUserName(userName) {
  return sessionStorage.setItem(userNameKey, userName)
  // return Cookies.set(userNameKey, userName)
}

/**
 * 移除
 */
export function removeUserName() {
  return sessionStorage.removeItem(userNameKey)
  // return Cookies.remove(userNameKey)
}